package com.yl.chainStore.payrule.coupons

import com.baomidou.mybatisplus.annotation.EnumValue
import com.fasterxml.jackson.annotation.JsonValue
import com.yl.chainStore.payrule.coupons.entity.DefaultCouponsRule
import com.yl.chainStore.payrule.coupons.entity.OrderFullReductionRule

/**
 * 优惠卷类型
 * code 名称  对应类型
 */
enum class CouponsRuleTypeEnum(@EnumValue val code: Int, @JsonValue val typeName: String, val clazz:Class<out CouponsRule>) {

	ORDER_FULL_REDUCTION_RULE(1,"普通满减", OrderFullReductionRule::class.java),

//	ONE_ITEM_FULL_REDUCTION_RULE(3,"商品满减", OneItemFullReductionRule::class.java),

	DEFAULT(99,"默认", DefaultCouponsRule::class.java);

	companion object {
		fun getEnum(d: Int?): CouponsRuleTypeEnum {
			return values()
				.find { it.code == (d ?: return DEFAULT) } ?: DEFAULT
		}
	}


}
